package pl.smath.view.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.RootPanel;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Smath_view implements EntryPoint {
	private final String[] anchors = {"Smath_view.html?page=NumberView", "Smath_view.html?page=VariableView", "Smath_view.html?page=SumView", "Smath_view.html?page=ProductView", "Smath_view.html?page=FractionView", "Smath_view.html?page=RootView"};
	private final String[] anchorNames = {"NumberView", "VariableView", "SumView", "ProductView", "FractionView", "RootView"};
	
	public void onModuleLoad() {
		for (int i = 0; i<anchors.length; i++) {
			Anchor anchor = new Anchor(anchorNames[i], anchors[i]);
			RootPanel.get("anchors").add(anchor);
		}
		// Associate the Main panel with the HTML host page.
		String value = com.google.gwt.user.client.Window.Location.getParameter("page");
		if ((value == null)||(value.compareTo("NumberView") == 0)) {
			RootPanel.get("view").add((new NumberViewSite()).getPanel());
		} else if (value.compareTo("VariableView") == 0) {
			RootPanel.get("view").add((new VariableViewSite()).getPanel());
		} else if (value.compareTo("SumView") == 0) {
			RootPanel.get("view").add((new SumViewSite()).getPanel());
		} else if (value.compareTo("ProductView") == 0) {
		RootPanel.get("view").add((new ProductViewSite()).getPanel());
		} else if (value.compareTo("FractionView") == 0) {
		RootPanel.get("view").add((new FractionViewSite()).getPanel());
		} else if (value.compareTo("RootView") == 0) {
		RootPanel.get("view").add((new RootViewSite()).getPanel());
		}
	}
}
